package com.cyd.rabbitmq.service;

import com.cyd.rabbitmq.bean.Book;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

/**
 * @Name : com.cyd.rabbitmq.service.BookService
 * @Description : 描述
 * Created by cyd on 2021-06-11 16:46:43
 */
@Service
public class BookService {

    @RabbitListener(queues = "cyd.news")
    public void receive(Book book) {
        System.out.println(book);
    }

    @RabbitListener(queues = "cyd")
    public void receiveMsg(Message msg) {
        System.out.println(msg.getBody());
        System.out.println(msg.getMessageProperties());
    }
}
